Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FlyteRemote.execute interruptible flag override #2885

Merged

Conversation

redartera
Copy link
Contributor

@redartera redartera commented Oct 31, 2024

Tracking issue

Closes flyteorg/flyte#5279

Why are the changes needed?

It is useful for users to invoke the same LaunchPlan but overriding at runtime whether they need executions to be interruptible or not. Currently this is possible through the Flyte UI, but not flytekit.

What changes were proposed in this pull request?

Support an interruptible option in FlyteRemote.execute

How was this patch tested?

Integration test added

Check all the applicable boxes

  • I updated the documentation accordingly (docstrings)
  • All new and existing tests passed.
  • All commits are signed-off.

Summary by Bito

This PR implements comprehensive system improvements including authentication, domain management, and remote execution features, while enhancing Flyte's type system with strict type matching and improved dictionary handling. Key additions include interruptible flag override in FlyteRemote, configurable chunk sizes for S3/GCS operations, and enhanced pod spec generation. The implementation includes a new type_match_checking module, enhanced DictTransformer functionality, and improved error handling. Additional features comprise VLLM integration, Kubernetes data service plugin, and improved async operations with configurable batch sizes.

Unit tests added: True

Estimated effort to review (1-5, lower is better): 5

@redartera redartera marked this pull request as ready for review October 31, 2024 15:11
pingsutw
pingsutw previously approved these changes Nov 4, 2024
@redartera
Copy link
Contributor Author

@pingsutw Can we please merge this PR?

@Future-Outlier Future-Outlier enabled auto-merge (squash) November 21, 2024 13:37
auto-merge was automatically disabled November 21, 2024 13:53

Head branch was pushed to by a user without write access

@redartera redartera force-pushed the flyteremote-interruptible-override branch from aa09a04 to e82b2ce Compare November 21, 2024 13:55
@redartera
Copy link
Contributor Author

redartera commented Nov 21, 2024

After merging main into the current branch - the Monodoc build started failing. I added a newline here thinking that was where the problem was coming from which dismissed the approval.

Actually I synched the master branch of my flytekit fork which is identical to the original, and Monodocs fails there too, which makes me think the failure is unrelated to this PR.

@Future-Outlier
Copy link
Member

After merging main into the current branch - the Monodoc build started failing. I added a newline here thinking that was there the problem was coming from which dismissed the approval.

Actually I synched the master branch of my flytekit fork which is identical to the original, and Monodocs fails there too, which makes me think the failure is unrelated to this PR.

yes this is my fault

@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 2, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Add Interruptible Flag Override Support

execution.py - Added interruptible flag support in execution model

remote.py - Implemented interruptible flag override in FlyteRemote execute methods

test_remote.py - Added integration test for interruptible flag override

test_execution.py - Added unit tests for interruptible flag in execution model

@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 13, 2025

Code Review Agent Run #fb24f7

Actionable Suggestions - 0
Additional Suggestions - 10
  • plugins/flytekit-optuna/flytekitplugins/optuna/optimizer.py - 1
    • Consider requiring positive concurrency value · Line 60-61
  • plugins/flytekit-inference/flytekitplugins/inference/vllm/serve.py - 1
    • Consider moving validation to HFSecret class · Line 44-47
  • flytekit/clis/sdk_in_container/run.py - 1
    • Consider consolidating JSON serialization logic · Line 478-486
  • tests/flytekit/unit/core/test_flyte_file.py - 1
  • flytekit/image_spec/default_builder.py - 1
  • tests/flytekit/integration/remote/test_remote.py - 3
    • Consider adding registration verification assertions · Line 819-819
    • Consider configurable workflow timeout value · Line 122-122
    • Consider extracting duplicate cleanup code · Line 854-887
  • plugins/flytekit-inference/tests/test_vllm.py - 1
    • Consider breaking down long assertion statement · Line 41-41
  • tests/flytekit/integration/remote/workflows/basic/flytefile.py - 1
    • Consider extracting duplicated file reading logic · Line 18-20
Review Details
  • Files reviewed - 30 · Commit Range: bc025a7..51c5305
    • flytekit/__init__.py
    • flytekit/clis/sdk_in_container/run.py
    • flytekit/core/array_node_map_task.py
    • flytekit/core/environment.py
    • flytekit/core/workflow.py
    • flytekit/image_spec/default_builder.py
    • flytekit/remote/remote.py
    • flytekit/types/directory/types.py
    • flytekit/types/file/file.py
    • plugins/flytekit-inference/flytekitplugins/inference/__init__.py
    • plugins/flytekit-inference/flytekitplugins/inference/vllm/serve.py
    • plugins/flytekit-inference/setup.py
    • plugins/flytekit-inference/tests/test_vllm.py
    • plugins/flytekit-onnx-pytorch/dev-requirements.txt
    • plugins/flytekit-optuna/flytekitplugins/optuna/__init__.py
    • plugins/flytekit-optuna/flytekitplugins/optuna/optimizer.py
    • plugins/flytekit-optuna/setup.py
    • plugins/flytekit-optuna/tests/test_optimizer.py
    • plugins/flytekit-spark/tests/test_environment.py
    • pyproject.toml
    • tests/flytekit/integration/remote/test_remote.py
    • tests/flytekit/integration/remote/utils.py
    • tests/flytekit/integration/remote/workflows/basic/attr_access_sd.py
    • tests/flytekit/integration/remote/workflows/basic/flytefile.py
    • tests/flytekit/integration/remote/workflows/basic/pydantic_wf.py
    • tests/flytekit/unit/core/image_spec/test_default_builder.py
    • tests/flytekit/unit/core/test_environment.py
    • tests/flytekit/unit/core/test_flyte_directory.py
    • tests/flytekit/unit/core/test_flyte_file.py
    • tests/flytekit/unit/core/test_workflows.py
  • Files skipped - 3
    • .github/workflows/pythonbuild.yml - Reason: Filter setting
    • plugins/flytekit-inference/README.md - Reason: Filter setting
    • plugins/flytekit-optuna/README.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 23, 2025

Code Review Agent Run #b66645

Actionable Suggestions - 0
Additional Suggestions - 10
  • tests/flytekit/integration/remote/test_remote.py - 1
  • tests/flytekit/unit/core/test_type_engine.py - 1
  • tests/flytekit/unit/core/test_array_node_map_task.py - 1
  • plugins/flytekit-k8sdataservice/tests/k8sdataservice/k8s/test_kube_config.py - 1
  • flytekit/remote/remote.py - 1
  • flytekit/exceptions/user.py - 1
    • Consider validating `timestamp` parameter · Line 18-18
  • flytekit/clis/sdk_in_container/serve.py - 1
  • tests/flytekit/unit/core/image_spec/test_default_builder.py - 1
  • plugins/flytekit-omegaconf/tests/test_dictconfig_transformer.py - 1
    • Add assertion for key4 in value_map · Line 80-80
  • tests/flytekit/unit/bin/test_python_entrypoint.py - 1
Review Details
  • Files reviewed - 69 · Commit Range: 51c5305..67037b3
    • .pre-commit-config.yaml
    • Dockerfile.agent
    • docs/source/plugins/k8sstatefuldataservice.rst
    • flytekit/bin/entrypoint.py
    • flytekit/clis/sdk_in_container/run.py
    • flytekit/clis/sdk_in_container/serve.py
    • flytekit/core/array_node_map_task.py
    • flytekit/core/context_manager.py
    • flytekit/core/node.py
    • flytekit/core/promise.py
    • flytekit/core/python_function_task.py
    • flytekit/core/type_engine.py
    • flytekit/core/worker_queue.py
    • flytekit/exceptions/user.py
    • flytekit/image_spec/default_builder.py
    • flytekit/image_spec/image_spec.py
    • flytekit/remote/remote.py
    • flytekit/tools/translator.py
    • plugins/flytekit-envd/flytekitplugins/envd/image_builder.py
    • plugins/flytekit-envd/tests/test_image_spec.py
    • plugins/flytekit-k8sdataservice/dev-requirements.txt
    • plugins/flytekit-k8sdataservice/flytekitplugins/k8sdataservice/__init__.py
    • plugins/flytekit-k8sdataservice/flytekitplugins/k8sdataservice/agent.py
    • plugins/flytekit-k8sdataservice/flytekitplugins/k8sdataservice/k8s/kube_config.py
    • plugins/flytekit-k8sdataservice/flytekitplugins/k8sdataservice/k8s/manager.py
    • plugins/flytekit-k8sdataservice/flytekitplugins/k8sdataservice/sensor.py
    • plugins/flytekit-k8sdataservice/flytekitplugins/k8sdataservice/task.py
    • plugins/flytekit-k8sdataservice/tests/k8sdataservice/k8s/test_kube_config.py
    • plugins/flytekit-k8sdataservice/tests/k8sdataservice/k8s/test_manager.py
    • plugins/flytekit-k8sdataservice/tests/k8sdataservice/test_agent.py
    • plugins/flytekit-k8sdataservice/tests/k8sdataservice/test_sensor.py
    • plugins/flytekit-k8sdataservice/tests/k8sdataservice/test_task.py
    • plugins/flytekit-k8sdataservice/tests/k8sdataservice/utils/test_resources.py
    • plugins/flytekit-k8sdataservice/utils/infra.py
    • plugins/flytekit-k8sdataservice/utils/resources.py
    • plugins/flytekit-kf-pytorch/flytekitplugins/kfpytorch/task.py
    • plugins/flytekit-kf-pytorch/tests/test_elastic_task.py
    • plugins/flytekit-omegaconf/flytekitplugins/omegaconf/dictconfig_transformer.py
    • plugins/flytekit-omegaconf/tests/test_dictconfig_transformer.py
    • plugins/flytekit-optuna/flytekitplugins/optuna/__init__.py
    • plugins/flytekit-optuna/flytekitplugins/optuna/optimizer.py
    • plugins/flytekit-optuna/setup.py
    • plugins/flytekit-optuna/tests/test_callback.py
    • plugins/flytekit-optuna/tests/test_decorator.py
    • plugins/flytekit-optuna/tests/test_imperative.py
    • plugins/flytekit-optuna/tests/test_optimizer.py
    • plugins/flytekit-optuna/tests/test_validation.py
    • plugins/flytekit-pydantic/flytekitplugins/pydantic/__init__.py
    • plugins/flytekit-pydantic/flytekitplugins/pydantic/basemodel_transformer.py
    • plugins/flytekit-pydantic/flytekitplugins/pydantic/commons.py
    • plugins/flytekit-pydantic/flytekitplugins/pydantic/deserialization.py
    • plugins/flytekit-pydantic/flytekitplugins/pydantic/serialization.py
    • plugins/flytekit-pydantic/tests/folder/test_file1.txt
    • plugins/flytekit-pydantic/tests/folder/test_file2.txt
    • plugins/flytekit-pydantic/tests/test_type_transformer.py
    • plugins/setup.py
    • tests/flytekit/clis/sdk_in_container/test_serve.py
    • tests/flytekit/integration/remote/test_remote.py
    • tests/flytekit/integration/remote/workflows/basic/signal_test.py
    • tests/flytekit/unit/bin/test_python_entrypoint.py
    • tests/flytekit/unit/core/image_spec/test_default_builder.py
    • tests/flytekit/unit/core/test_array_node_map_task.py
    • tests/flytekit/unit/core/test_dataclass.py
    • tests/flytekit/unit/core/test_generice_idl_type_engine.py
    • tests/flytekit/unit/core/test_type_engine.py
    • tests/flytekit/unit/core/test_type_hints.py
    • tests/flytekit/unit/core/test_worker_queue.py
    • tests/flytekit/unit/exceptions/test_user.py
    • tests/flytekit/unit/remote/test_remote.py
  • Files skipped - 4
    • .github/workflows/pythonbuild.yml - Reason: Filter setting
    • plugins/flytekit-k8sdataservice/README.md - Reason: Filter setting
    • plugins/flytekit-optuna/README.md - Reason: Filter setting
    • plugins/flytekit-pydantic/README.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@wild-endeavor
Copy link
Contributor

do we really need or can we remove the wrapper in the model for the bool value? it's a oneof but i think just setting the bool should be enough. could we also add it to one of the unit tests in here

obj2 = _execution.ExecutionSpec.from_flyte_idl(obj.to_flyte_idl())
please?

I know the model files are annoying and unnecessary to work with, thank you for bearing with us.

@redartera redartera force-pushed the flyteremote-interruptible-override branch from 47876c6 to 73cae9e Compare January 23, 2025 19:51
@redartera
Copy link
Contributor Author

redartera commented Jan 23, 2025

do we really need or can we remove the wrapper in the model for the bool value? it's a oneof but i think just setting the bool should be enough. could we also add it to one of the unit tests in here

obj2 = _execution.ExecutionSpec.from_flyte_idl(obj.to_flyte_idl())

please?
I know the model files are annoying and unnecessary to work with, thank you for bearing with us.

Good catch thank you - not super familiar with the models - learned something new.

Removed the wrapper here bcbb991
Added to the unit test here 73cae9e

edit: passing a raw bool doesn't work in ExecutionSpec

@redartera
Copy link
Contributor Author

redartera commented Jan 23, 2025

do we really need or can we remove the wrapper in the model for the bool value? it's a oneof but i think just setting the bool should be enough. could we also add it to one of the unit tests in here

obj2 = _execution.ExecutionSpec.from_flyte_idl(obj.to_flyte_idl())

please?
I know the model files are annoying and unnecessary to work with, thank you for bearing with us.

Good catch thank you - not super familiar with the models - learned something new.

Removed the wrapper here bcbb991 Added to the unit test here 73cae9e

edit: passing a raw bool doesn't work in ExecutionSpec

Quick update - it seems to be indeed a BoolValue in flyteidl https://github.com/flyteorg/flyte/blob/8125ae1b96b4b41e237be396c2e0dd21141117ce/flyteidl/protos/flyteidl/admin/execution.proto#L327

Would you advise to stick with the google wrapper - or is there a better alternative?

@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 23, 2025

Code Review Agent Run #2ccc25

Actionable Suggestions - 0
Additional Suggestions - 1
  • flytekit/models/execution.py - 1
Review Details
  • Files reviewed - 2 · Commit Range: 67037b3..73cae9e
    • flytekit/models/execution.py
    • tests/flytekit/unit/models/test_execution.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@redartera redartera force-pushed the flyteremote-interruptible-override branch from 2d668ea to e2083da Compare January 28, 2025 14:15
@redartera
Copy link
Contributor Author

It looks like ExecutionSpec only accepts a BoolValue wrapper (link) - couldn't get it to work any other way. I placed the wrapper back in and added test to flytekit/tests/flytekit/unit/models/test_execution.py as advised

@flyte-bot
Copy link
Contributor

flyte-bot commented Jan 28, 2025

Code Review Agent Run #616c34

Actionable Suggestions - 0
Additional Suggestions - 10
  • flytekit/models/security.py - 1
    • Consider adding env_var validation check · Line 45-45
  • flytekit/core/data_persistence.py - 2
    • Consider more descriptive environment variable name · Line 57-57
    • Consider configurable chunksize for storage backends · Line 130-131
  • tests/flytekit/unit/core/test_data_persistence.py - 1
    • Consider validating chunksize parameter value · Line 237-238
  • flytekit/core/type_engine.py - 3
    • Consider more descriptive environment variable name · Line 63-63
    • Consider simplifying dictionary value update logic · Line 2186-2190
    • Consider using asyncio.gather for coroutines · Line 2162-2165
  • plugins/flytekit-ray/tests/test_ray.py - 2
    • Consider moving pod_template inside test function · Line 23-27
    • Consider extracting pod template creation logic · Line 67-73
  • tests/flytekit/unit/core/test_resources.py - 1
    • Consider more specific pod spec assertions · Line 157-157
Review Details
  • Files reviewed - 25 · Commit Range: 73cae9e..e2083da
    • .pre-commit-config.yaml
    • flytekit/core/data_persistence.py
    • flytekit/core/resources.py
    • flytekit/core/type_engine.py
    • flytekit/image_spec/default_builder.py
    • flytekit/image_spec/image_spec.py
    • flytekit/models/execution.py
    • flytekit/models/security.py
    • flytekit/models/task.py
    • flytekit/remote/remote_fs.py
    • flytekit/types/structured/structured_dataset.py
    • plugins/flytekit-ray/flytekitplugins/ray/task.py
    • plugins/flytekit-ray/setup.py
    • plugins/flytekit-ray/tests/test_ray.py
    • pydoclint-errors-baseline.txt
    • pyproject.toml
    • tests/flytekit/integration/remote/test_remote.py
    • tests/flytekit/integration/remote/workflows/basic/get_secret.py
    • tests/flytekit/unit/core/image_spec/test_default_builder.py
    • tests/flytekit/unit/core/test_data_persistence.py
    • tests/flytekit/unit/core/test_dataclass.py
    • tests/flytekit/unit/core/test_list.py
    • tests/flytekit/unit/core/test_resources.py
    • tests/flytekit/unit/extras/pydantic_transformer/test_pydantic_basemodel_transformer.py
    • tests/flytekit/unit/types/structured_dataset/test_structured_dataset.py
  • Files skipped - 1
    • .github/workflows/pythonbuild.yml - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Contributor

flyte-bot commented Feb 10, 2025

Code Review Agent Run #683644

Actionable Suggestions - 0
Additional Suggestions - 10
  • flytekit/models/domain.py - 1
    • Consider adding input validation for parameters · Line 14-16
  • flytekit/image_spec/image_spec.py - 1
    • Consider adding validation for pip secrets · Line 51-53
  • flytekit/image_spec/default_builder.py - 1
    • Consider extracting secret mount handling logic · Line 486-488
  • flytekit/tools/translator.py - 1
    • Consider extracting pod template construction logic · Line 478-487
  • tests/flytekit/unit/models/core/test_security.py - 1
    • Consider adding valid env var tests · Line 57-61
  • flytekit/models/security.py - 1
    • Consider extracting env var pattern constant · Line 59-60
  • flytekit/remote/remote.py - 2
  • flytekit/types/structured/structured_dataset.py - 1
  • tests/flytekit/unit/clients/auth/test_keyring_store.py - 1
    • Consider using AuthType enum for auth_mode · Line 64-64
Review Details
  • Files reviewed - 41 · Commit Range: e2083da..e7439d5
    • dev-requirements.txt
    • flytekit/bin/entrypoint.py
    • flytekit/clients/auth_helper.py
    • flytekit/clients/friendly.py
    • flytekit/clients/grpc_utils/auth_interceptor.py
    • flytekit/clients/raw.py
    • flytekit/core/base_task.py
    • flytekit/core/context_manager.py
    • flytekit/core/node.py
    • flytekit/core/type_engine.py
    • flytekit/deck/deck.py
    • flytekit/image_spec/default_builder.py
    • flytekit/image_spec/image_spec.py
    • flytekit/interaction/parse_stdin.py
    • flytekit/loggers.py
    • flytekit/models/core/workflow.py
    • flytekit/models/domain.py
    • flytekit/models/security.py
    • flytekit/models/task.py
    • flytekit/remote/remote.py
    • flytekit/tools/fast_registration.py
    • flytekit/tools/translator.py
    • flytekit/types/directory/types.py
    • flytekit/types/structured/structured_dataset.py
    • pydoclint-errors-baseline.txt
    • pyproject.toml
    • tests/flytekit/integration/remote/test_remote.py
    • tests/flytekit/integration/remote/workflows/basic/sd_attr.py
    • tests/flytekit/unit/clients/auth/test_keyring_store.py
    • tests/flytekit/unit/clients/test_auth_helper.py
    • tests/flytekit/unit/clients/test_friendly.py
    • tests/flytekit/unit/clients/test_raw.py
    • tests/flytekit/unit/core/image_spec/test_default_builder.py
    • tests/flytekit/unit/core/image_spec/test_image_spec.py
    • tests/flytekit/unit/core/test_array_node_map_task.py
    • tests/flytekit/unit/core/test_map_task.py
    • tests/flytekit/unit/core/test_node_creation.py
    • tests/flytekit/unit/core/test_unions.py
    • tests/flytekit/unit/deck/test_deck.py
    • tests/flytekit/unit/models/core/test_security.py
    • tests/flytekit/unit/test_translator.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 but looking into the failing test.

@redartera
Copy link
Contributor Author

redartera commented Feb 10, 2025

+1 but looking into the failing test.

The failing test in GH actions seems to be a wf execution timeout error.

I tried to replicate locally on a codespace workstation - the integration test passes but fails in a different place, namely when trying to clean up the S3 file. Please see local test log below

@redartera ➜ /workspaces/flytekit (flyteremote-interruptible-override) $ make integration_test_codecov
make CODECOV_OPTS="--cov=./ --cov-report=xml --cov-append" integration_test
make[1]: Entering directory '/workspaces/flytekit'
pytest -n auto --dist=loadfile tests/flytekit/integration --cov=./ --cov-report=xml --cov-append -m "not lftransfers"
============================================================================= test session starts =============================================================================
platform linux -- Python 3.12.1, pytest-8.3.4, pluggy-1.5.0
rootdir: /workspaces/flytekit
configfile: pyproject.toml
plugins: anyio-4.7.0, mock-3.14.0, hypothesis-6.125.2, asyncio-0.25.3, xdist-3.6.1, timeout-2.3.1, icdiff-0.9, cov-6.0.0
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=function
4 workers [47 items]    
......................ss..............

...
FFF.ss<unknown>:18: SyntaxWarning: invalid escape sequence '\w'
<unknown>:19: SyntaxWarning: invalid escape sequence '\w'
/workspaces/flytekit/tests/flytekit/unit/models/admin/test_common.py:18: SyntaxWarning: invalid escape sequence '\w'
  o = _common.Sort.from_python_std(' asc(my"\wackyk3y) ')  # noqa: W605
/workspaces/flytekit/tests/flytekit/unit/models/admin/test_common.py:19: SyntaxWarning: invalid escape sequence '\w'
  assert o.key == 'my"\wackyk3y'  # noqa: W605
                                                                                                                         [100%]
================================================================================== FAILURES ===================================================================================
________________________________________________________________________________ test_open_ff _________________________________________________________________________________
[gw0] linux -- Python 3.12.1 /usr/local/python/3.12.1/bin/python3

    def test_open_ff():
        """Test opening FlyteFile from a remote path."""
        # Upload a file to minio s3 bucket
        file_transfer = SimpleFileTransfer()
        remote_file_path = file_transfer.upload_file(file_type="json")
    
        execution_id = run("flytefile.py", "wf", "--remote_file_path", remote_file_path)
        remote = FlyteRemote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
        execution = remote.fetch_execution(name=execution_id)
        execution = remote.wait(execution=execution, timeout=datetime.timedelta(minutes=5))
        assert execution.closure.phase == WorkflowExecutionPhase.SUCCEEDED, f"Execution failed with phase: {execution.closure.phase}"
    
        # Delete the remote file to free the space
        url = urlparse(remote_file_path)
        bucket, key = url.netloc, url.path.lstrip("/")
>       file_transfer.delete_file(bucket=bucket, key=key)

tests/flytekit/integration/remote/test_remote.py:889: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/flytekit/integration/remote/utils.py:100: in delete_file
    res = self._s3_client.delete_object(Bucket=bucket, Key=key)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:569: in _api_call
    return self._make_api_call(operation_name, kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:1005: in _make_api_call
    http, parsed_response = self._make_request(
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:1029: in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:119: in make_request
    return self._send_request(request_dict, operation_model)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:196: in _send_request
    request = self.create_request(request_dict, operation_model)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:132: in create_request
    self._event_emitter.emit(
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:412: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:256: in emit
    return self._emit(event_name, kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:239: in _emit
    response = handler(**kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/signers.py:106: in handler
    return self.sign(operation_name, request)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/signers.py:198: in sign
    auth.add_auth(request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <botocore.auth.S3SigV4Auth object at 0x7ec1e6e2ad20>, request = <botocore.awsrequest.AWSRequest object at 0x7ec1e6f6a660>

    def add_auth(self, request):
        if self.credentials is None:
>           raise NoCredentialsError()
E           botocore.exceptions.NoCredentialsError: Unable to locate credentials

/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/auth.py:423: NoCredentialsError
_____________________________________________________________________________ test_attr_access_sd _____________________________________________________________________________
[gw0] linux -- Python 3.12.1 /usr/local/python/3.12.1/bin/python3

    def test_attr_access_sd():
        """Test accessing StructuredDataset attribute from a dataclass."""
        # Upload a file to minio s3 bucket
        file_transfer = SimpleFileTransfer()
        remote_file_path = file_transfer.upload_file(file_type="parquet")
    
        execution_id = run("attr_access_sd.py", "wf", "--uri", remote_file_path)
        remote = FlyteRemote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN)
        execution = remote.fetch_execution(name=execution_id)
        execution = remote.wait(execution=execution, timeout=datetime.timedelta(minutes=5))
        assert execution.closure.phase == WorkflowExecutionPhase.SUCCEEDED, f"Execution failed with phase: {execution.closure.phase}"
    
        # Delete the remote file to free the space
        url = urlparse(remote_file_path)
        bucket, key = url.netloc, url.path.lstrip("/")
>       file_transfer.delete_file(bucket=bucket, key=key)

tests/flytekit/integration/remote/test_remote.py:907: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/flytekit/integration/remote/utils.py:100: in delete_file
    res = self._s3_client.delete_object(Bucket=bucket, Key=key)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:569: in _api_call
    return self._make_api_call(operation_name, kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:1005: in _make_api_call
    http, parsed_response = self._make_request(
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:1029: in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:119: in make_request
    return self._send_request(request_dict, operation_model)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:196: in _send_request
    request = self.create_request(request_dict, operation_model)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:132: in create_request
    self._event_emitter.emit(
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:412: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:256: in emit
    return self._emit(event_name, kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:239: in _emit
    response = handler(**kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/signers.py:106: in handler
    return self.sign(operation_name, request)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/signers.py:198: in sign
    auth.add_auth(request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <botocore.auth.S3SigV4Auth object at 0x7ec1e637fb30>, request = <botocore.awsrequest.AWSRequest object at 0x7ec1e63141a0>

    def add_auth(self, request):
        if self.credentials is None:
>           raise NoCredentialsError()
E           botocore.exceptions.NoCredentialsError: Unable to locate credentials

/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/auth.py:423: NoCredentialsError
________________________________________________________________________________ test_sd_attr _________________________________________________________________________________
[gw0] linux -- Python 3.12.1 /usr/local/python/3.12.1/bin/python3

    def test_sd_attr():
        """Test correctness of StructuredDataset attributes.
    
        This test considers only the following condition:
        1. Check StructuredDataset (wrapped in a dataclass) file_format attribute
    
        We'll make sure uri aligns with the user-specified one in the future.
        """
        from workflows.basic.sd_attr import wf
    
        @dataclass
        class DC:
            sd: StructuredDataset
    
        FILE_FORMAT = "parquet"
    
        # Upload a file to minio s3 bucket
        file_transfer = SimpleFileTransfer()
        remote_file_path = file_transfer.upload_file(file_type=FILE_FORMAT)
    
        # Create a dataclass as the workflow input because `pyflyte run`
        # can't properly handle input arg `dc` as a json str so far
        dc = DC(sd=StructuredDataset(uri=remote_file_path, file_format=FILE_FORMAT))
    
        remote = FlyteRemote(Config.auto(config_file=CONFIG), PROJECT, DOMAIN, interactive_mode_enabled=True)
        wf_exec = remote.execute(
            wf,
            inputs={"dc": dc, "file_format": FILE_FORMAT},
            wait=True,
            version=VERSION,
            image_config=ImageConfig.from_images(IMAGE),
        )
        assert wf_exec.closure.phase == WorkflowExecutionPhase.SUCCEEDED, f"Execution failed with phase: {wf_exec.closure.phase}"
        assert wf_exec.outputs["o0"].file_format == FILE_FORMAT, (
            f"Workflow output StructuredDataset file_format should align with the user-specified file_format: {FILE_FORMAT}."
        )
    
        # Delete the remote file to free the space
        url = urlparse(remote_file_path)
        bucket, key = url.netloc, url.path.lstrip("/")
>       file_transfer.delete_file(bucket=bucket, key=key)

tests/flytekit/integration/remote/test_remote.py:950: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/flytekit/integration/remote/utils.py:100: in delete_file
    res = self._s3_client.delete_object(Bucket=bucket, Key=key)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:569: in _api_call
    return self._make_api_call(operation_name, kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:1005: in _make_api_call
    http, parsed_response = self._make_request(
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/client.py:1029: in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:119: in make_request
    return self._send_request(request_dict, operation_model)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:196: in _send_request
    request = self.create_request(request_dict, operation_model)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/endpoint.py:132: in create_request
    self._event_emitter.emit(
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:412: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:256: in emit
    return self._emit(event_name, kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/hooks.py:239: in _emit
    response = handler(**kwargs)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/signers.py:106: in handler
    return self.sign(operation_name, request)
/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/signers.py:198: in sign
    auth.add_auth(request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <botocore.auth.S3SigV4Auth object at 0x7ec1e59c6db0>, request = <botocore.awsrequest.AWSRequest object at 0x7ec1e59c6450>

    def add_auth(self, request):
        if self.credentials is None:
>           raise NoCredentialsError()
E           botocore.exceptions.NoCredentialsError: Unable to locate credentials

/usr/local/python/3.12.1/lib/python3.12/site-packages/botocore/auth.py:423: NoCredentialsError
---------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------
18:26:13.275310 WARNING  remote.py:289 - Jupyter notebook and interactive task  
                         support is still alpha.                                
============================================================================== warnings summary ===============================================================================
../../home/codespace/.local/lib/python3.12/site-packages/pythonjsonlogger/__init__.py:24: 10 warnings
  /home/codespace/.local/lib/python3.12/site-packages/pythonjsonlogger/__init__.py:24: DeprecationWarning: pythonjsonlogger.jsonlogger has been moved to pythonjsonlogger.json
    warnings.warn(

<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: Type google._upb._message.MessageMapContainer uses PyType_Spec with a metaclass that has custom tp_new. This is deprecated and will no longer be allowed in Python 3.14.

<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: Type google._upb._message.ScalarMapContainer uses PyType_Spec with a metaclass that has custom tp_new. This is deprecated and will no longer be allowed in Python 3.14.

../../home/codespace/.local/lib/python3.12/site-packages/jupyter_client/connect.py:22
../../home/codespace/.local/lib/python3.12/site-packages/jupyter_client/connect.py:22
../../home/codespace/.local/lib/python3.12/site-packages/jupyter_client/connect.py:22
../../home/codespace/.local/lib/python3.12/site-packages/jupyter_client/connect.py:22
  /home/codespace/.local/lib/python3.12/site-packages/jupyter_client/connect.py:22: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6
    from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write

tests/flytekit/integration/remote/test_remote.py: 11 warnings
  /workspaces/flytekit/flytekit/core/base_task.py:833: DeprecationWarning: `disable_deck` is deprecated and will be removed in the future.
  Please use `enable_deck` instead.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.12.1-final-0 -----------
Coverage XML written to file coverage.xml

=========================================================================== short test summary info ===========================================================================
FAILED tests/flytekit/integration/remote/test_remote.py::test_open_ff - botocore.exceptions.NoCredentialsError: Unable to locate credentials
FAILED tests/flytekit/integration/remote/test_remote.py::test_attr_access_sd - botocore.exceptions.NoCredentialsError: Unable to locate credentials
FAILED tests/flytekit/integration/remote/test_remote.py::test_sd_attr - botocore.exceptions.NoCredentialsError: Unable to locate credentials
====================================================== 3 failed, 40 passed, 4 skipped, 35 warnings in 2063.87s (0:34:23) ======================================================
make[1]: *** [Makefile:94: integration_test] Error 1
make[1]: Leaving directory '/workspaces/flytekit'
make: *** [Makefile:90: integration_test_codecov] Error 2

@wild-endeavor
Copy link
Contributor

it's succeeding locally for me too. the auth error you're seeing is a bit different, my guess is it's just failing because the minio password isn't set where you're running it. and different attempts are failing on different tests.

@redartera
Copy link
Contributor Author

it's succeeding locally for me too. the auth error you're seeing is a bit different, my guess is it's just failing because the minio password isn't set where you're running it. and different attempts are failing on different tests.

they're succeeding remotely now too - I think something made them flaky and some executions timeout sometimes (I saw a flyte execution timeout error in the GH action logs)

@wild-endeavor wild-endeavor merged commit 74bde49 into flyteorg:master Feb 11, 2025
107 of 112 checks passed
@flyte-bot
Copy link
Contributor

flyte-bot commented Feb 11, 2025

Code Review Agent Run #f887d7

Actionable Suggestions - 0
Review Details
  • Files reviewed - 9 · Commit Range: e7439d5..884517e
    • flytekit/core/promise.py
    • flytekit/core/type_engine.py
    • flytekit/core/type_match_checking.py
    • flytekit/remote/remote.py
    • tests/flytekit/integration/remote/test_remote.py
    • tests/flytekit/unit/core/test_annotated_bindings.py
    • tests/flytekit/unit/core/test_generice_idl_type_engine.py
    • tests/flytekit/unit/core/test_type_engine.py
    • tests/flytekit/unit/core/test_type_match_checking.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

AI Code Review powered by Bito Logo

ChihTsungLu pushed a commit to ChihTsungLu/flytekit that referenced this pull request Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

per-execution interruptible flag not piped through via flytekit
6 participants